import { sendRequest } from '@/http';

const baseUrl = '/admin/institution';

/* 获取用户所有的院区 */
export const queryList = (params: any) =>
  sendRequest({
    url: `${baseUrl}/queryRpScopeFiltrate`,
    method: 'get',
    params,
  });

/* 创建养老机构院区 */
export const createBranch = (data: any) =>
  sendRequest({
    url: `${baseUrl}/createInstBranch`,
    method: 'post',
    data,
  });

/* 编辑养老机构院区 */
export const editInstBranch = (data: any) =>
  sendRequest({
    url: `${baseUrl}/editInstBranch`,
    method: 'post',
    data,
  });

export const queryInstBranchInfo = (branchId: string) =>
  sendRequest({
    url: `${baseUrl}/queryInstBranchInfo`,
    method: 'get',
    params: { branchId },
  });

/* 禁用养老机构院区 */
export const disableInstBranch = (branchId: string) =>
  sendRequest({
    url: `${baseUrl}/disableInstBranch`,
    method: 'post',
    data: { branchId },
  });

/* 启用养老机构院区 */
export const ableInstBranch = (branchId: string) =>
  sendRequest({
    url: `${baseUrl}/ableInstBranch`,
    method: 'post',
    data: { branchId },
  });

/* 删除分院 */
export const deleteBranch = (branchId: string) =>
  sendRequest({
    url: `${baseUrl}/deleteBranch`,
    method: 'post',
    data: { branchId },
  });

/* 获取用户所有的院区 */
export const queryInstInfrastructure = () =>
  sendRequest({
    url: `${baseUrl}/queryInstInfrastructure`,
    method: 'get',
  });
